package org.weasel.unittests;

import java.sql.Time;

import junit.framework.TestCase;

import org.weasel.business.Developer;
import org.weasel.business.Task;
import org.weasel.business.UserStory;

public class UserStoryTest extends TestCase {

	private UserStory us;
	
	
	protected void setUp() throws Exception {
		super.setUp();
		us = new UserStory("1", "name","03.04.2007", null, "descritpion", Time.valueOf("00:01:00"), Time.valueOf("00:01:00"), 2, 2, false, null, null);
	}

	protected void tearDown() throws Exception {
		super.tearDown();
		us = null;
	}

	public void testAddGetDeveloper() {
		Developer d = new Developer("HInnerhofer", "Hannes", "Stift", "keine@gmx.net");
		us.addDeveloper(d);
		Developer dCheck = us.getDeveloper(d.getId());
		assertEquals(d.getId(), dCheck.getId());
	}

	public void testRemoveDeveloper() {
		Developer d = new Developer("HInnerhofer", "Hannes", "Stift", "keine@gmx.net");
		us.addDeveloper(d);
		us.removeDeveloper(d.getId());
		assertNull(us.getDeveloper(d.getId()));
	}

	public void testAddTask() {
		Task t = new Task("task1", "description", false);
		us.addTask(t);
		Task tCheck = us.getTask(t.getId());
		assertEquals(t.getId(), tCheck.getId());
	}

	public void testRemoveTask() {
		Task t = new Task("task1", "description", false);
		us.addTask(t);
		us.removeTask(t.getId());
		assertNull(us.getTask(t.getId()));
	}

	

}
